<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title id="title"></title>
<script type="text/javascript" src="scripts/xmlLoader.js"></script>
<script type="text/javascript" src="scripts/get.js"></script>
<script type="text/javascript" src="scripts/display_result.js"></script>
<script type="text/javascript">
function buildMenu() {
	var xml = loadXMLDoc("menu.xml");
	var menuContainer = document.getElementById("menu");
	var items = xml.getElementsByTagName("item");
	var html = "<table>\n<tr>\n";
	for (var i=0;i<items.length;i++) {
		html += "<td><div>"+extractHREF(items[i].childNodes[0].nodeValue)+"</div></td>\n";
	}
	html += "</tr>\n</table>\n";
	menuContainer.innerHTML = html;
}

function extractHREF(filename) {
	path = "pages/"
	xml = loadXMLDoc(path+filename);
	try {
		return "<a href=\"./index.html?xml="+filename.substring(0,filename.indexOf('.xml'))+"\">"+xml.getElementsByTagName("heading")[0].childNodes[0].nodeValue+"</a>";
	} catch (e) {
		return "<a href=\"./index.html?xml="+filename.substring(0,filename.indexOf('.xml'))+"\">"+filename+"</a>";
	}
}
</script>
<script type="text/javascript">
path = "pages/";

var xml = _GET['xml'];
var xsl = _GET['xsl'];
if(xml == null || xml == "") {
	xml = 'index';
}
if(xsl == null || xsl == "") {
	xsl = 'template1';
}
xml = path+xml+'.xml';
xsl = xsl+'.xsl';
</script>
<link rel="stylesheet" type="text/css" href="styles/style.css" />

</head>

<body id="body" onload="displayResult(xml, xsl);">


</body>
</html>
